import Vue from 'vue';
const getOpUrl = '/api/common/localstorage/getPageOperation';
export default Vue.extend({
  methods: {
    // 获取操作的共用方法
    GetOperationList(search,searchid,name) {
      let pageUrl = this.$route.name
      if(pageUrl === 'testPaper'
         || pageUrl === 'pushExam'
         || pageUrl === 'examAnalysis'
         || pageUrl === 'proctorManage'
         || pageUrl === 'examreport'
         || pageUrl === 'examreportOne'
         || pageUrl === 'approvaledList'
         || pageUrl === 'notApprovaledList'
         || pageUrl === 'unsubmittedList'
         || pageUrl === 'addExamOne'
         || pageUrl === 'addExamTwo'
         || pageUrl === 'studentExamDetail'
         || pageUrl === 'studentExamDetailOne'
         || pageUrl === 'studentExamDetail2'
         || pageUrl === 'studentExamDetail3'
         || pageUrl === 'studentExamDetail4'
         || pageUrl === 'stuWordHtml'
         || pageUrl === 'stuWordHtmlOne'
         || pageUrl === 'stuWordHtml2'
         || pageUrl === 'stuWordHtml3'
         || pageUrl === 'stuWordHtml4'
         || pageUrl === 'dataAnalysis'
         || pageUrl === 'cutScreenDetails'
         || pageUrl === 'questionTypeAnalysis'
         || pageUrl === 'wrongStuList'
         || pageUrl === 'stuCard'
         || pageUrl === 'stuTickets' 
         || pageUrl === 'addExam'
         || pageUrl === 'editExamOne'
         || pageUrl === 'editExamTwo'
         || pageUrl === 'editExam'
         || pageUrl === 'examWord'
         || pageUrl === 'examWord1'
         || pageUrl === 'examWord2'
         || pageUrl === 'examMonitorStuOne'
         || pageUrl === 'reviewPaper'){
        pageUrl = 'examManagement'  //防止获取面包屑报错
      }else if(pageUrl === 'proctorManageOne'){
        pageUrl = 'invigilateManagement'
      }else if(pageUrl === 'markedPaper' || pageUrl === 'approvalPaper'){
        pageUrl = 'approvalManagement'
      }else if(pageUrl === 'newQuestion' || pageUrl === 'editQuestion'){
        pageUrl = 'addQuestion'
      }
      name && (pageUrl = name)
      return this.$http
        .post(getOpUrl, {
          pageUrl,
          [search]:searchid,
        })
        .then((rst) => {
          return rst;
        });
    }
  }
});
